﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls;
using Silvermoon.Windows;
using Silvermoon.Windows.Styles;
using System.IO;
using System.Diagnostics;

namespace Testing.Pages
{
    public class StackPanelPage : DemoWindowBase
    {
        public StackPanelPage()
            : base()
        {
            InitializePage();
        }

        private string[] colorNames = new string[] { "red", "green", "blue", "orange", "lime" };
        private string[] yesNoUnknown = new string[] { "yes", "no", "unknown" };

        private void InitializePage()
        {
            Title = "SCROLLSTACKPANEL";
            Styles = new MetroStyles();
            Color = PhoneColors.Dark;
            ScrollStackPanel panel = new ScrollStackPanel { Margin = Margin.Zero };
            TextBox textBox1 = new TextBox { Height = 64, Margin = new Margin(0, 0, 24, 10), AutoHeight = true, AcceptReturn = true, Padding = new Margin(10, 17, 10, 17) };
            DropDownBox ddb1 = new DropDownBox { Margin = new Margin(0, 0, 24, 20) };
            Label l0 = new Label("Info");
            Label l1 = new Label("Accent color");
            Label l2 = new Label("Known type");
            DropDownBox ddb2 = new DropDownBox { Margin = new Margin(0, 0, 24, 20) };
            ddb1.GetVirtualItem += new EventHandler<ItemEventArgs>(cv_GetVirtualItem);
            ddb2.GetVirtualItem += new EventHandler<ItemEventArgs>(cv_GetVirtualItem);
            panel.Controls.Add(l0, textBox1, l1, ddb1, l2, ddb2);
            Controls.Add(panel);
            ddb1.ItemsSource = colorNames;
            ddb2.ItemsSource = yesNoUnknown;
        }


        void cv_GetVirtualItem(object sender, ItemEventArgs e)
        {
            e.Item = new TextItem { Text = (e.Value as string), Font = FontPool.ItemFont };
        }



    }
}
